package org.fxcontainer.commands.navigation.chain
{
	import com.developmentarc.core.actions.commands.AbstractCommand;
	
	import org.fxcontainer.commands.URLChangeCommand;
	
	
	/**
	 * Represents <code>Page</code> part of navigation URL. 
	 * @author Izzet_Mustafayev
	 */
	public final class Page
	{
		
		/**
		 * The navigation URL. 
		 */
		private var navURL:NavigationURL;
		
		/**
		 * The navigation command.
		 */
		private var command:URLChangeCommand;
		
		/**
		 * The <code>Page</code> URL part constructor. 
		 * @param _command the <code>NavigateCommand</code> instance reference
		 * @param _navURL the <code>NavigationURL</code> instance reference
		 */
		public function Page(_command:URLChangeCommand, _navURL:NavigationURL)
		{
			this.navURL = _navURL;
			this.command = _command;
		}
		
		/**
		 * Adds control to invoke. 
		 * @param controlName the control name to invoke
		 * @param methodName the control method name to invoke
		 * @param args the control method arguments 
		 * @return the command to be despatched
		 */
		public function touchControl(controlName:String, methodName:String=null, ... args:Array):AbstractCommand
		{
			this.navURL.touchControl(controlName, methodName, args);
			return command;
		}
		
		public function touchControlQueue(controlName:String, methodName:String=null, ... args:Array):ControlQueue
		{
			return navURL.touchControlQueue(command, controlName, methodName, args); 
		}
		
	}
}